package com.apes.framework.plugin.condition.model;

import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.Model;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;

@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = StrategyAuth.CONST_TABLE_NAME)
public class StrategyAuth extends Model {

    public static final String CONST_TABLE_NAME = "aut_condition";

    @Id
    @Column(name = "id", length = 10)
    @ApesGenerator(code = CONST_TABLE_NAME, name = "策略权限")
    @Comment("编码")
    private String id;

    @Column(name = "AUT_APPROVE", nullable = false)
    @Comment("审核权限")
    private boolean autApprove;

    @Column(name = "AUT_CREATE", nullable = false)
    @Comment("创建权限")
    private boolean autCreate;

    @Column(name = "AUT_QRY_EXEC", nullable = false)
    @Comment("查询执行表")
    private boolean autQryExec;

    @Column(name = "AUT_STOP", nullable = false)
    @Comment("终止权限")
    private boolean autStop;

    @Column(name = "CONDITION_ID",length = 32)
    @Comment("策略编码")
    private String conditionId;

    @Column(name = "CONDITION_NAME",length = 200)
    @Comment("策略名称")
    private String conditionName;


    @Column(name = "ROLE_ID",length = 255)
    @Comment("通用角色")
    private String roleId;

    @Transient
    private String type;

}

